package com.atguigu.tingshu.search.cron;

import com.atguigu.tingshu.search.runable.RebuildDistroBloomFilterRunnable;
import com.atguigu.tingshu.search.service.impl.ItemServiceImpl;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

//@Component
public class RebuildDistroBloomFilterTask {
    @Autowired
    private RedissonClient redissonClient;
    @Autowired
    private ItemServiceImpl itemServiceImpl;
    @Autowired
    private StringRedisTemplate redisTemplate;

//    @Scheduled(cron = "0 0/2 * * * ? ")
//    @Scheduled(cron = "0 0/2 * 0/7 * ? ")
    public void rebuildDistroBloomFilter() {
        Thread thread = new Thread(new RebuildDistroBloomFilterRunnable(redissonClient, itemServiceImpl, redisTemplate));
        thread.start();
    }
}
